/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package newkfp;

import java.util.Date;
import javax.ejb.EJB;
import javax.faces.context.FacesContext;
import javax.faces.view.facelets.FaceletContext;
import javax.servlet.http.HttpSession;


/**
 *
 * @author $alama
 */
public class Loger {
   
    @EJB
    private static newkfp.LogFacade ejbFacade;

    
    
    
    public  void LogerString(String logComment,int type){
     HttpSession session = (HttpSession)  FacesContext.getCurrentInstance().getExternalContext().getSession(false);
        Log log= new Log();
        Employee employee=new Employee((Integer)session.getValue("empid"));
        log.setEmployee(employee);
        log.setDateLog(new Date());
        log.setMessage(logComment);
        log.setType(type);
        
        if(ejbFacade != null){
            ejbFacade.create(log);
            
        }else{
            System.out.println("////Null Facade");
        }
    }

    Loger(LogFacade logFacade) {
        ejbFacade = logFacade;
        
    }
    
}
